package minioutil

import "errors"

type config struct {
	Endpoint     string `yaml:"endpoint"`
	AccessKey    string `yaml:"accesskey"`
	AccessSecret string `yaml:"accesssecret"`
	UseSSL       bool   `yaml:"ssl"`
	Bucket       string `yaml:"bucket"`
}

var (
	Config config
)

// 初始化配置文件
func ConfigInit(endpoint, accesskey, accesssecret, bucket string, usessl bool) {
	if endpoint == "" || accesskey == "" || accesssecret == "" {
		panic(errors.New("缺少必要配置"))
	}
	Config = config{
		Endpoint:     endpoint,
		AccessKey:    accesskey,
		AccessSecret: accesssecret,
		UseSSL:       usessl,
		Bucket:       bucket,
	}
}
